package appx.craft.droid.ui;

import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ListView;
import appx.craft.droid.R;
import appx.craft.droid.bean.RsvCellBean;
import appx.craft.droid.bean.RsvTableBean;
import appx.craft.droid.uc.ITableCellListener;
import appx.craft.droid.uc.RsvpListAdapter;

public class Activity_2143_screen extends Activity implements ITableCellListener {
	
	private final String TAG = Activity_2143_screen.class.getCanonicalName();
	
	private ListView table_list_view;
	private RsvpListAdapter mListViewAdapter;
	private ArrayList<RsvTableBean> mArrayTableList;
	private ArrayList<RsvCellBean> mArrayCellList;
	RsvCellBean mCellTempBean;
	RsvTableBean mcatchBean;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_2143_screen);
		Log.d(TAG,"onCreate");
		
		// main array list of RsvTable bean 
		mArrayTableList = new ArrayList<RsvTableBean>();
		
		// catch bean that hold item 
		mcatchBean = new RsvTableBean();
		
		// Header view in list view 
		mcatchBean.setCellHeader("RSVP");
		
		mcatchBean.setCellHeaderMessage("Enabling this function Enabling this function Enabling this function Enabling this function ");
		
		mcatchBean.setCelllistHeaderMessage("List");
		 
		// switch off 
		mcatchBean.setToggleSwitch(true);
		
		
	//**************************************************
	// each cell items
		
		mArrayCellList  = new ArrayList<RsvCellBean>();
		
		for (int i = 0; i < 10; i++) {
			
			mCellTempBean = new RsvCellBean();
			
			mCellTempBean.setRowID(""+i);
			
			mCellTempBean.setImageURL("");
			
			mCellTempBean.setRowText("K&K");
			
			mCellTempBean.setRowText1("Feature is activated");
			
			mCellTempBean.setItemChecked(false);
			
			mArrayCellList.add(mCellTempBean);
		}
		
				
		mcatchBean.setmArrayList_cellBean(mArrayCellList);
		
		 
		mArrayTableList.add(mcatchBean);	
		
		
		table_list_view =(ListView)findViewById(R.id.table_list_view);
		
		mListViewAdapter = new RsvpListAdapter(Activity_2143_screen.this);
		
		table_list_view.setAdapter(mListViewAdapter);
		
		mListViewAdapter.addTableItems(mArrayTableList);
		
	}
	
	@Override
	protected void onStart() {
		super.onStart();
		Log.d(TAG,"onStart");
	}
	
	@Override
	protected void onPause() {
		super.onPause();
		Log.d(TAG,"onPause");
	}
	
	@Override
	protected void onResume() {
		super.onResume();
		Log.d(TAG,"onResume");
	}
	
	@Override
	protected void onDestroy() {
		super.onDestroy();
		Log.d(TAG,"onDestroy");
	}
	
	/**
	 * when you click on table cell item this callback is call
	 * to handle the cell click just used this below call back
	 */
	@Override
	public void onTableCellItemClick(int vCellPosition, int vPosition) {
		// TODO Auto-generated method stub
		
	}
}
